<form action="/admini/system/optionitem"  method="post" style="margin:0px" id="form1">
    <div style=" border:1px solid #DDDDDD; padding:2px; margin:2px;line-height: 36px;" id='sel'> 
        <label for="quick">key搜索：</label><input type="text" id="quick" name="name" value="<?php echo $this->name;?>"/>
        <input type="submit" id="queryButton" name="queryButton" value="查询"/>
    </div>
</form>

<div class="dataTable">
    <table>         
    <tfoot>
      <tr><td colspan="14"><input class="button" id="add-button" type="button" value="添加"/></td>
      </tr>
    </tfoot>
        <tr>
            <th class="w1" width="5px"></th>
            <th class="w2" width="5%" nowrap>ID</th>
            <th class="w3" width="18%" nowrap>键</th>
            <th class="w4" width="50%" nowrap>值</th>
            <th class="w5" width="26%" nowrap>描述</th>
            <th class="w12"></th>
        </tr>  

     
        <?php
        
        if ($this->optionlist) {
            foreach ($this->optionlist as $Item) {
    
                ?>
                    
                <tr>
                    <td class="w1" width="5px"><input type="checkbox" value="<?php echo $Item->id; ?>" class="checkbox-del" name='checkbox'/></td>
                    <td class="w2"><?php echo $Item->id; ?></td>
                    <td class="w3"><a href="javascript:void(0)" id="edit-a" name="<?php echo $Item->id; ?>" class="indexa"><?php echo $Item->mykey; ?></a></td>
                    <td class="w4"><?php echo $Item->myvalue; ?></td>
                    <td class="w5"><?php echo $Item->description; ?></td>
                    <td class="w12"></td>
                </tr>
        <?php
    }
}
?>
    </table>
</div>                
<div class="toolbar">
    
    <?php //echo $this->partial('paging.phtml', array("pages" => $this->userall,"pamas"=>"username=".$this->nikename."&email=$this->email&storeno=$this->storeno&dateselect=$this->dateselect&starttime=$this->starttime&endtime=$this->endtime")); ?>
    <?php echo $this->partial('paging.phtml', array("pages" => $this->optionall,"pamas"=>"name=".$this->name."&dateselect=$this->dateselect&starttime=$this->starttime&endtime=$this->endtime")); ?>
</div>

<div class="tanchuang" style="display:none;" id="add_optionitem">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="edithead" style="display:none;">更新参数设置</div>
        <div class="nui-msgbox-hd" id="addhead" style="display:none;">添加参数设置</div>
        <a class="nui-msgbox-close" title="关闭" id="exitissue"><b></b></a>
    </div>
    <div class="neirbox">
        <form method="post" action="/admini/system/addprocess" id="formissue">
	<table>
            <tr>
            	<td class="askl">键：</td>
                <td><input type="text" name="mykey" id="mykey" class="input w400"></td>
            </tr>
            <tr>
            	<td class="askl">值：</td>
                <td><textarea cols="60" rows="6" id="myvalue" name="myvalue"></textarea></td>
            </tr>
            <tr>
            	<td class="askl">描述：</td>
                <td><textarea cols="56" rows="3" id="description" name="description"></textarea></td>
            </tr>
        </table>
        <div class="neirboxok">
            <input type="hidden" id="id" name="optionid" value="" />
            <a class="anvbotton" href="javascript:void(0)" id="subissue"><span>确认提交</span></a>
        </div>  
        </form>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<?php
if(isset($this->message) && $this->message!=""){
    echo '<script language="javascript" type="text/javascript">alert("'. $this->message .'")</script>';
}
?>

<script type="text/javascript" language="javascript">
    $('#add-button').click(function(){
        $(".neirbox #mykey").val("");
        $(".neirbox #myvalue").val("");
        $(".neirbox #description").val("");
        $(".neirbox input#id").val("");
        $('#add_optionitem').attr("style","display:block");
        $('#addhead').attr("style","display:block");
        $("#edithead").attr("style","display:none;");
        $("div.houtai_overlay").attr("style","display:block;");
    });
    $('#exitissue').click(function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $('#add_optionitem').attr("style","display:none;");
    })
    $("#subissue").live("click",function(){
       var mykey = $(".neirbox #mykey").val(); 
       var myvalue = $(".neirbox #myvalue").val(); 
       var description = $(".neirbox #description").val(); 
       if(mykey == ""){
           alert("键不能为空！");
           return false;
       }else if(myvalue == ""){
           alert("值不能为空！");
           return false;
       }else if(description == ""){
           alert("描述不能为空！");
           return false;
       }else{
           $("#formissue").submit();
       }
    });
    
    $('#edit-a').live("click",function(){
        var id = $(this).attr("name");
       $.ajax({
            type: 'POST',
            url: "/admini/system/edit?id="+id,
            success: function(data) {
                if(data.type == 1){
                    $(".neirbox #mykey").val(data.mykey);
                    $(".neirbox #myvalue").val(data.myvalue);
                    $(".neirbox #description").val(data.description);
                    $(".neirbox input#id").val(id);
                    $('#add_optionitem').attr("style","display:block");
                    $("div#edithead").attr("style","display:block;");
                    $("div#addhead").attr("style","display:none;");
                    $("div.houtai_overlay").attr("style","display:block;");
                }else{
                    alert("发生未知错误！");
                }
           }
       });
    });
</script>


